/**
 * Created by henian.xu on 2018/10/9.
 *
 */

import RouterInterceptors from './interceptors';

export default {
    install(Vue, { router, store, GlobalVar } = {}) {
        // 注入拦截器
        new RouterInterceptors(router, store, GlobalVar);
        // 添加公用路由
        router.addRoutes([
            {
                path: '/login',
                name: 'login',
                component: () => import(/* webpackChunkName: "cpf" */ '../pages/login.vue'),
                meta: {
                    title: '登录',
                },
            },
            {
                path: '/error/:statusCode',
                name: 'error',
                component: () => import(/* webpackChunkName: "cpf" */ '../pages/error.vue'),
                meta: {
                    title: '错误页面',
                },
            },
            {
                path: '*',
                name: 'error2',
                component: () => import(/* webpackChunkName: "cpf" */ '../pages/error.vue'),
                meta: {
                    title: '错误页面',
                },
            },
        ]);
    },
};
